<?php

namespace App\Controller\Common;

use App\Base\BaseController;
//use BaseExt\QRcode;
//use App\Model\LazyCommon\PlatConfigModel;
//use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
//use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use BaseExt\QRcode;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class CommonController extends BaseController
{
    /**
     * @Route("/getSessId" ,name="getSessId")
     */
    public function getSessId(Request $request)
    {
        return $this->json_out(1,"OK",session_id());
    }

    /**
     * @Route("/Qr" ,name="Qr")
     */
    public function Qr()
    {
        if(!$code = $this->getParamRequired("code")){return $this->json_out(0,"参数缺失");}
        $errorCorrectionLevel = 'L';//容错级别
        $matrixPointSize = 12;//生成图片大小
        //生成二维码图片
        require(__DIR__."/../../../BaseExt/QRcode.php");
        $QRcode = new QRcode();
        $QRcode->png($code, false, $errorCorrectionLevel, $matrixPointSize, 2);
        die;
    }

    /**
     * @Route("/test" ,name="comtest")
     */
    public function comtest()
    {
        die($this->getParameter('oss_url'));

    }

}
